package gamefw.tests;

import junit.framework.TestCase;
import gamefw.framework.Coordinate;
import gamefw.framework.Move;

public class TestMove extends TestCase {

	/**
	 * MV01
	 * Test the correct creation of a Move instance
	 */
	public void testMoveCreation () {
		Coordinate c1 = new Coordinate(0,0);
		Coordinate c2 = new Coordinate(1,1);
		Move mv = new Move(c1, c2);
		
		assertTrue(mv.getFrom().getX() == 0);
		assertTrue(mv.getFrom().getY() == 0);
		assertTrue(mv.getTo().getX() == 1);
		assertTrue(mv.getTo().getY() == 1);
	}
	
	/**
	 * MV02
	 * Test to check if Move class setters work correctly
	 */
	public void testSetters() {
		Coordinate c1 = new Coordinate(0,0);
		Coordinate c2 = new Coordinate(1,1);
		Move mv = new Move(c1, c2);

		Coordinate c3 = new Coordinate(2,2);
		Coordinate c4 = new Coordinate(3,3);

		mv.setFrom(c3);
		mv.setTo(c4);
		
		assertTrue(mv.getFrom().getX() == 2);
		assertTrue(mv.getFrom().getY() == 2);
		assertTrue(mv.getTo().getX() == 3);
		assertTrue(mv.getTo().getY() == 3);
	}
}
